package com.zua.controller;
import com.zua.entity.Admin;
import com.zua.service.AdminService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
@CrossOrigin(origins = "*",allowCredentials = "true")
@RestController
@RequestMapping("admin")
public class AdminController {
    @Autowired
    private AdminService adminService;
    @PostMapping("login")
    public Map login(@RequestBody Admin admin){
        HashMap<String, String> map = new HashMap<>();
        Admin admin1 = adminService.selectOne(admin.getName());
        if(admin.getPassword().equals(admin1.getPassword())){
            map.put("status","success");
        }else{
            map.put("status","failed");
        }
        return map;
    }
}
